<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <link href="../libs/mui.min.css" rel="stylesheet"/>
    <link rel="stylesheet" type="text/css" href="../libs/app.css"/>
    <link href="../css/main.css" rel="stylesheet"/>
    <link href="../css/home.css" rel="stylesheet"/>
    <link rel="stylesheet" href="../css/swiper-3.3.1.min.css"/>
</head>
<body>
<div class="home-context">
    <div class="home-select">
        <div id="credit" onclick="href('home/credit.html','credit')" class="noFast"><img
                src="../images/home-select1.png">
            <p>信用贷</p></div>
        <div id="pledeg" onclick="href('home/pledge.html','pledeg',{type:'fcdy'})" class="noFast"><img
                src="../images/home-select2.png">
            <p>抵押贷</p></div>
        <div id="assess" onclick="href('home/assess.html','assess')"><img src="../images/home-select3.png">
            <p>贷款评估</p></div>
        <div id="pay-in" onclick="href('home/pay-in.html','pay-in',{type:'aj'})"><img src="../images/home-select4.png">
            <p>垫资服务</p></div>
        <div id="sign-card" onclick="href('home/sign-card.html','sign-card')"><img src="../images/home-select6.png">
            <p>信用卡</p></div>
        <div id="erya" onclick="href('home/erya.html','erya',{type:'2y'})" class="noFast"><img
                src="../images/home-select5.png">
            <p>二押贷</p></div>
        <div id="car" onclick="href('home/car.html','car',{type:'qcdy'})" class="noFast"><img
                src="../images/home-select7.png">
            <p>汽车贷</p></div>
        <div id="fast" onclick="href('home/fast.html','fast')"><img src="../images/home-select8.png">
            <p>快速贷款</p></div>
    </div>
    <div style="height: 5px; background-color: black"></div>

    <!--轮播图-->
    <div class="swiper-container" style="height: 10rem;width: 100%;">
        <div class="swiper-wrapper">

        </div>
        <div class="swiper-pagination"></div>
    </div>

    <div style="height: 5px; background-color: black"></div>
    <div class="home-three" id="small" onclick="href('home/small.html','small')">
        <!-- <span class="home-small">小额贷款</span>
         <div><p class="home-left">放款时间</p><p class="home-right">10分钟-6分钟</p></div>
         <div><p class="home-left">放款范围</p><p class="home-right">500元-800元</p></div>
         <div style="color: #999999">推荐理由：精选更多贷款产品，在线提交材料，完成申请后急速放款。</div>-->
    </div>
    <div style="height: 5px; background-color: black"></div>
    <div class="home-news" id="news">
        <p id="new-list" style="margin-top: 0.5rem;"><span class="home-news-left">热点资讯</span><span
                class="home-news-right" style="color: #999999">更多资讯<img src="../images/jian.png"></span></p>
        <p class="home-news-title">
            <span class="home-news-title-content"></span>
            <span class="home-news-title-center"></span>
        </p><br>
        <p class="home-news-time" style="color: #999999"></p>
        <p class="home-news-look" style="color: #999999"><span class="home-news-look-num">0</span>人阅读</p>
        <div class="home-news-picture"></div>
    </div>
</div>

<script src="../libs/mui.min.js"></script>
<script src="../js/jquery-3.1.1.min.js"></script>
<script src="../js/url.js"></script>
<script src="../js/swiper-3.3.1.jquery.min.js"></script>
<script type="text/javascript">
    $('.noFast').on('tap', function () {
        localStorage.fastPassAskfor = 'false';
    })
    addimg();
    addnews();

    localStorage.fastPassAskfor = 'false';
    //轮播图接口
    function addimg() {
        $.ajax({
            url: ur + 'rest/advertisingPositionController/list/',
            type: 'GET',
            dataType: 'json',
            headers: {
                "X-Token": localStorage.token
            },
            data: {
                type: 0
            }
        })
            .done(function (data) {
                var s = data.data.list.length;
                var i = 0;
                for (i; i < s; i++) {
                    var images = $('<div class="swiper-slide"><img src="' + ur + data.data.list[i].image + '" alt="" height="100%" width="100%"/></div>');
                    images.attr("herf", data.data.list[i].link);
                    $('.swiper-wrapper').append(images);
                }
                var mySwiper = new Swiper('.swiper-container', {
                    autoplay: 3000,//可选选项，自动滑动
                    pagination: '.swiper-pagination',
                    paginationClickable: true,
                    loop: true,
                    autoplayDisableOnInteraction: false,//点击后依然可自动滑动
                })
            })
    }
    //小额贷图片
    $.ajax({
        url: ur + 'rest/advertisingPositionController/list/',
        type: 'GET',
        dataType: 'json',
        headers: {
            "X-Token": localStorage.token
        },
        data: {
            type: 1
        },
        success: function (res) {
            if (res.meta.code === 'S002') {
                var list = res.data.list;
                var img = document.createElement('img');
                $(img).addClass('xed-img');
                img.src = ur + list[0].image;
                $('#small').append(img);
            } else {
            }
        }
    })

    //热点资讯接口
    function addnews() {
        $.ajax({
            url: ur + 'rest/informationController/list',
            type: 'GET',
            dataType: 'json',
            headers: {
                "X-Token": localStorage.token
            },
            data: {}
        })
            .done(function (data) {
                tit = data.data.list[0].title;
                time = data.data.list[0].uploadTime;
                peo = data.data.list[0].readNumber;
                $('.home-news-title-content').text(tit);
                $('.home-news-time').text(time);
                $('.home-news-look-num').text(peo);
                $('#news').attr('ids', data.data.list[0].id);
                $('.home-news-picture').attr("style", "background-image: url(" + ur + data.data.list[0].image + ")");
            })
    }


    //热点资讯列表及详情
    $('#news').on('tap', function (e) {
        e.stopPropagation();
        localStorage.news_id = $(this).attr('ids');
        href('home/news.html', 'news');
    })

    $('#new-list').on('tap', function (e) {
        e.stopPropagation();
        href('home/new-list.html', 'new-list');
    })

//    mui.plusReady(function () {
//        plus.navigator.setStatusBarBackground("#000");
//        plus.navigator.closeSplashscreen();
//    })


    //广告位打开新页面
    $('.swiper-wrapper').on('tap', '.swiper-slide', function () {
        localStorage.swiper_id = $(this).attr('herf');
        href('home/swiper-news.html', '');
    })
</script>
</body>
</html>